<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let xhr = new XMLHttpRequest();
        //withCredentials是XMLHttpRequest的一个属性，该属性定义了是否在请求中携带cookie
        //默认情况下此值为 false,这意味着不携带cookie,如果true,则携带 cookie
        xhr.withCredentials='include';
        xhr.open('GET','http://127.0.0.1:8080/visit',true);
        xhr.onload = ()=>{
            console.log(xhr.responseText)
        }
        xhr.send();
    </script>
</body>
</html>